<?xml version="1.0" encoding="windows-1251"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:output method="xml" encoding="utf-8" />
	<xsl:template match="files">
		<items>
			<xsl:variable name="items"
				select="document(doc/@filename)/item" />
			<xsl:for-each select="$items">
				<item>
					<xsl:apply-templates select="*" />
				</item>
			</xsl:for-each>
		</items>
	</xsl:template>
	<xsl:template match="*">
		<xsl:copy>
			<xsl:for-each select="@*">
				<xsl:copy />
			</xsl:for-each>
			<xsl:apply-templates />
		</xsl:copy>
	</xsl:template>
</xsl:stylesheet>
